// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database() //初始化数据库
exports.main = async (event, context) => {
  const dbName = event.db;
  const collection = db.collection(dbName)
  let data = event.data;
  data = data.id ? {_id:data.id} : {name:data.name}
  
  const res = await collection.where(data).remove()
  return res
};
